package day9;



//另类加法，不使用运算符；
public class oj1 {
    public int addAB(int A, int B) {
        // write code here
        if(A == 0) {
            return B;
        } else if(B == 0) {
            return A;
        }
        int sum = 0;
        int carray = 0;
        while(B != 0) {
            sum = A ^ B;
            carray = (A & B) << 1;
            A = sum;
            B = carray;
        }
        return A;
    }


}
